package day3.p3;

/*
 * Create a class called CalcAverage that has the following method:
 * public double avgFirstN(int N)
 * This method receives an integer as a parameter and calculates the
 * average of first N natural numbers. If N is not a natural number,
 * throw an exception IllegalArgumentException with an appropriate message.
 */

public class CalcAverage {
	public double avgFirstN(int n) throws IllegalArgumentException {
		int sum = 0, c = n;
		while (n > 0)
			sum += n;
		return n / c;
	}
}
